extends Control

var file=File.new()
var dir=Directory.new()

func _enter_tree():
	$"sc/vbc/debug/cb".pressed=i.keys.debug
	$"sc/vbc/jump_splash/cb".pressed=sys.jump_splash
	$"sc/vbc/dialogue_font_size/le".text=str(d.font.size)
	$"sc/vbc/phone_ctrl/cb".pressed=sys.phone_ctrl.is_phone_ctrl

func _exit_tree():
	sys.save_settings()
	var s=$"sc/vbc/dialogue_font_size/le".text.to_int()
	if(s):
		d.resize_font(s)

func jump_startup_pressed():
	sys.jump_splash=!sys.jump_splash

func debug_pressed():
	i.keys.debug=!i.keys.debug

func _on_dialogue_font_size_focus_exited():
	var s=$"sc/vbc/dialogue_font_size/le".text.to_int()
	if(s):
		d.resize_font(s)

func _on_test_dialogue_pressed():
	sys.settings_exitable=false
	$"sc/vbc/dialogue_font_size/test_dialogue".disabled=true
	yield(d.open_box(),"completed")
	yield(d.p("test_text0\n/w1测试文本零"),"completed")
	yield(d.n(),"completed")
	yield(d.close_box(),"completed")
	$"sc/vbc/dialogue_font_size/test_dialogue".disabled=false
	sys.settings_exitable=true

#func _on_ESC_pressed():
#	i.keys.accept=true

func _on_caps_fix_pressed():
	i.hold_run=$"sc/vbc/caps/cb".pressed

func phone_ctrl_pressed():
	sys.phone_ctrl.visible=$"sc/vbc/phone_ctrl/cb".pressed
	sys.phone_ctrl.is_phone_ctrl=$"sc/vbc/phone_ctrl/cb".pressed
